package com.xiaobai.zhuangxiuguanjia.Utils;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.widget.TextView;

/**
 * Created by Android Studio
 * Project: ZhuangXiuGuanJia
 * Author: Jack
 * Email: jackfangqi1314@gmail.com/jackfangqi@163.com
 * Date: 2015/6/16
 */
public class PhoneCall {
    public static void phoneCall(final Context context) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setTitle("拨打电话");
        TextView textView = new TextView(context);
        textView.setText("土巴兔装修咨询热\n线：400-6900-282");
        textView.setTextSize(15);
        textView.setTextColor(Color.rgb(0x21, 0x21, 0x21));
//                textView.setGravity(Gravity.CENTER_VERTICAL);
        builder.setView(textView);
        builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.setPositiveButton("拨打", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_CALL);
                intent.setData(Uri.parse("tel:4006900282"));
                context.startActivity(intent);
            }
        });
        builder.show();
    }
}
